package src;

import static org.junit.Assert.*;

import org.junit.Test;

public class GridLocationTest
{
    int mainRow = 0;
    int mainCol = 0; 
    int subRow = 0; 
    int subCol = 0;

    @Test
    public void testGridLocation()
    {
    }

    @Test
    public void testGetMainRow()
    {
        GridLocation loc = new GridLocation(mainRow, mainCol, subRow, subCol);
        assertEquals(mainRow, loc.getMainRow(), 0);
    }

    @Test
    public void testGetMainCol()
    {
        GridLocation loc = new GridLocation(mainRow, mainCol, subRow, subCol);
        assertEquals(mainCol, loc.getMainCol(), 0);

    }

    @Test
    public void testGetSubRow()
    {
        GridLocation loc = new GridLocation(mainRow, mainCol, subRow, subCol);
        assertEquals(subRow, loc.getSubRow(), 0);
        
    }

    @Test
    public void testGetSubCol()
    {
        GridLocation loc = new GridLocation(mainRow, mainCol, subRow, subCol);
        assertEquals(subCol, loc.getSubCol(), 0);
    }

    @Test
    public void testEqualsObject()
    {
        GridLocation other = new GridLocation(0,0, 0, 0);
        assertEquals(mainRow , other.getMainRow());
        assertEquals(mainCol, other.getMainRow());
        assertEquals(subRow , other.getSubRow());
        assertEquals(subCol, other.getSubCol());
        
    }

    @Test
    public void testToString()
    {
        GridLocation loc = new GridLocation(mainRow, mainCol, subRow, subCol);
        String expected = "(" + mainRow + ", " +mainCol+", "+subRow+", "+subCol+")"; 
        assertEquals(expected, loc.toString());
        
    }

    @Test
    public void testNetworkToString()
    {
        GridLocation loc = new GridLocation(mainRow, mainCol, subRow, subCol);
        String expected = mainRow + "," + mainCol + "," + subRow + "," + subCol; 
        assertEquals(expected, loc.networkToString());
        
    }

}
